import Vue from 'vue'
import VueRouter from 'vue-router'
const headNavMenu = () => import(/* webpackChunkName: "home" */ '../components/headNavMenu')
const register = () => import(/* webpackChunkName: "register" */ '../views/register')
const login = () => import(/* webpackChunkName: "login" */ '../views/login')
const example = () => import(/* webpackChunkName: "example" */ '../common/components/example')
const AD = () => import(/* webpackChunkName: "ad" */ '../components/test/AD')
const AD2 = () => import(/* webpackChunkName: "ad" */ '../components/test/AD2')
const About = () => import(/* webpackChunkName: "about" */ '../views/About.vue')
const publishArticles = () => import(/* webpackChunkName: "public_article" */ '../views/publishArticles')
const categoryManager = () => import(/* webpackChunkName: "category" */ '../views/categoryManager')
const Home = () => import(/* webpackChunkName: "article" */ '../views/Home.vue')
const article = () => import(/* webpackChunkName: "article" */ '../views/article')
const allTopic = () => import(/* webpackChunkName: "topics" */ '../views/allTopic')
const report = () => import(/* webpackChunkName: "report" */ '../views/report')
const articleExposure = () => import(/* webpackChunkName: "report" */ '../components/report/articleExposure')
const FansDistribution = () => import(/* webpackChunkName: "report" */ '../components/report/FansDistribution')
const fansNumber = () => import(/* webpackChunkName: "report" */ '../components/report/fansNumber')
const userCenter = () => import(/* webpackChunkName: "user_center" */ '../views/userCenter')
const userCenterMyArticle = () => import(/* webpackChunkName: "user_center" */ '../components/user/userCenterMyArticle')
const userCenterMyLike = () => import(/* webpackChunkName: "user_center" */ '../components/user/userCenterMyLike')
const userCenterMyComment = () => import(/* webpackChunkName: "user_center" */ '../components/user/userCenterMyComment')
const userCenterMyCollection = () => import(/* webpackChunkName: "user_center" */ '../components/user/userCenterMyCollection')
const userCenterMyfans = () => import(/* webpackChunkName: "user_center" */ '../components/user/userCenterMyFans')
const userCenterMyLV = () => import(/* webpackChunkName: "user_center" */ '../components/user/userCenterMyLV')
const userCenterMycoins = () => import(/* webpackChunkName: "user_center" */ '../components/user/userCenterMyCoins')
const userCenterMyAuthentication = () => import(/* webpackChunkName: "user_center" */ '../components/user/userCenterMyAuthentication')
const userCenterMySettings = () => import(/* webpackChunkName: "user_center" */ '../components/user/userCenterMySettings')
const userCenterMyInfo = () => import(/* webpackChunkName: "user_center" */ '../components/user/userCenterMyInfo')
Vue.use(VueRouter)

const routes = [{
  path: '/',
  name: 'homePage',
  component: headNavMenu,
  redirect: '/index',
  children: [
    { name: 'PublishNote', path: '/publish', component: publishArticles },
    { name: 'ArticleCategory', path: '/category_manager', component: categoryManager },
    { name: 'index', path: '/index', component: Home },
    { name: 'essay', path: '/essay/content', component: article },
    { name: 'topics', path: '/topics', component: allTopic },
    { name: 'register', path: '/register', component: register },
    { name: 'login', path: '/page_of_login', component: login },
    {
      name: 'report',
      path: '/data/report',
      component: report,
      children: [
        { path: '/data/report', component: articleExposure },
        { path: '/data/setting', component: FansDistribution },
        { path: '/data/myinfo', component: fansNumber }
      ]
    },
    {
      name: 'userCenter',
      path: 'user/center',
      component: userCenter,
      redirect: 'center/article',
      children: [
        { path: '/center/article', component: userCenterMyArticle },
        { path: '/center/like', component: userCenterMyLike },
        { path: '/center/comment', component: userCenterMyComment },
        { path: '/center/collection', component: userCenterMyCollection },
        { path: '/center/fans', component: userCenterMyfans },
        { path: '/center/lv', component: userCenterMyLV },
        { path: '/center/coins', component: userCenterMycoins },
        { path: '/center/auth', component: userCenterMyAuthentication },
        { path: '/center/setting', component: userCenterMySettings },
        { path: '/center/myinfo', component: userCenterMyInfo }
      ]
    }
  ]
},
{ name: 'example', path: '/example', component: example },
{ name: 'ad', path: '/ad', component: AD },
{ name: 'ad2', path: '/ad2', component: AD2 },
{ name: 'About', path: '/about', component: About }
]

const router = new VueRouter({
  // mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
